import Main from '@/components/main'
// import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 *  menuActive: (-) 设置字段，默认为空，默认menu activeName对应路由名（route.name）；可设置字段（如：home），则menu activeName 为home
 *  to (-)设置该字段，则面包屑跳转至该设置字段
 * }
 */

export default [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/login.vue')
  },
  // {
  //   path: '/',
  //   name: '_home',
  //   // redirect: '/home',
  //   component: Main,
  //   meta: {
  //     hideInMenu: true,
  //     notCache: true
  //   },
  //   children: [
  //     {
  //       path: '/home',
  //       name: 'home',
  //       meta: {
  //         hideInMenu: true,
  //         title: '首页',
  //         notCache: true,
  //         icon: 'md-home'
  //       },
  //       component: () => import('@/view/single-page/home')
  //     }
  //   ]
  // },
  {
    path: '/',
    name: 'project',
    redirect: '/project_list',
    component: Main,
    meta: {
      hideInMenu: false,
      icon: 'logo-buffer',
      title: '项目管理'
    },
    children: [
      {
        path: 'project_list',
        name: 'project_list',
        meta: {
          icon: 'ios-folder',
          title: '我的项目',
          notCache: true
        },
        component: () => import('@/view/project-management/my-project/my-project.vue')
      },
      {
        path: 'approval_list',
        name: 'approval_list',
        meta: {
          icon: 'ios-create',
          title: '审批项目'
        },
        component: () => import('@/view/project-management/approval-project/approval-project.vue')
      }
    ]
  },
  {
    path: '/project_list',
    name: '_project',
    meta: {
      // hide: true,
      hideInMenu: true,
      icon: 'ios-folder',
      title: '我的项目',
      access: ['super_admin'],
      notCache: false,
      to: '/project_list'
    },
    component: Main,
    children: [
      {
        path: 'project_item_detail/:projectId',
        name: 'project_item_detail',
        meta: {
          icon: 'ios-infinite',
          title: route => route.params && route.params.projectName ? `项目-${route.params.projectName}` : '新建项目',
          notCache: false,
          access: ['super_admin'],
          beforeCloseName: 'before_close_normal'
        },
        component: () => import('@/view/project-preview/project-item-detail')
      }
    ]
  },
  {
    path: '/general_configuration',
    name: 'general_configuration',
    meta: {
      // hide: true,
      // hideInMenu: true,
      icon: 'ios-construct',
      title: '通用配置',
      notCache: true
    },
    component: Main,
    children: [
      {
        path: 'business_management',
        name: 'business_management',
        meta: {
          icon: 'ios-pulse',
          title: '业务类型管理'
        },
        component: () => import('@/view/general-configuration/business-management/business-management.vue')
      },
      {
        path: 'data_management',
        name: 'data_management',
        meta: {
          icon: 'md-podium',
          title: '数据管理'
        },
        component: () => import('@/view/general-configuration/data-management/data-management.vue')
      },
      {
        path: 'method_management',
        name: 'method_management',
        meta: {
          icon: 'md-analytics',
          title: '方法管理'
        },
        component: () => import('@/view/general-configuration/method-management/method-management.vue')
      }
      // {
      //   path: 'rule_management',
      //   name: 'rule_management',
      //   meta: {
      //     icon: 'md-swap',
      //     title: '规则管理'
      //   },
      //   component: () => import('@/view/general-configuration/rule-management/rule-management.vue')
      // }
    ]
  },
  {
    path: '/authorityManagement',
    name: 'authorityManagement',
    meta: {
      title: '权限管理',
      icon: 'md-albums'
    },
    component: Main,
    children: [
      {
        path: 'userManage',
        name: 'userManage',
        meta: {
          title: '用户管理',
          icon: 'md-contact'
        },
        component: () => import('@/view/authority-management/user-manage/user-manage.vue')
      },
      {
        path: 'organization',
        name: 'organization',
        meta: {
          icon: '_bear',
          title: '组织机构'
        },
        component: () => import('@/view/authority-management/organization/organization.vue')
      },
      {
        path: 'roleManage',
        name: 'roleManage',
        meta: {
          icon: '_bear',
          title: '角色管理'
        },
        component: () => import('@/view/authority-management/role-manage/role-manage.vue')
      }
    ]
  },
  {
    path: '/components',
    name: 'components',
    meta: {
      icon: 'ios-list-box',
      title: '组件',
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'drag_list_page',
        name: 'drag_list_page',
        meta: {
          icon: 'ios-infinite',
          title: '拖拽列表'
        },
        component: () => import('@/view/components/drag-list/drag-list.vue')
      },
      {
        path: 'icons_page',
        name: 'icons_page',
        meta: {
          icon: '_bear',
          title: '自定义图标'
        },
        component: () => import('@/view/components/icons/icons.vue')
      }
    ]
  },
  {
    path: '/tools_methods',
    name: 'tools_methods',
    meta: {
      hide: true,
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'tools_methods_page',
        name: 'tools_methods_page',
        meta: {
          icon: 'ios-hammer',
          title: '工具方法',
          beforeCloseName: 'before_close_normal'
        },
        component: () => import('@/view/tools-methods/tools-methods.vue')
      }
    ]
  },
  {
    path: '/error_logger',
    name: 'error_logger',
    meta: {
      hide: true,
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'error_logger_page',
        name: 'error_logger_page',
        meta: {
          icon: 'ios-bug',
          title: '错误收集'
        },
        component: () => import('@/view/single-page/error-logger.vue')
      }
    ]
  },
  {
    path: '/directive',
    name: 'directive',
    meta: {
      hide: true,
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'directive_page',
        name: 'directive_page',
        meta: {
          icon: 'ios-navigate',
          title: '指令'
        },
        component: () => import('@/view/directive/directive.vue')
      }
    ]
  },
  {
    path: '/argu',
    name: 'argu',
    meta: {
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'params/:id',
        name: 'params',
        meta: {
          icon: 'md-flower',
          title: route => `动态路由-${route.params.id}`,
          notCache: false,
          beforeCloseName: 'before_close_normal'
        },
        component: () => import('@/view/argu-page/params.vue')
      },
      {
        path: 'query',
        name: 'query',
        meta: {
          icon: 'md-flower',
          title: route => `带参路由-${route.query.id}`,
          notCache: false
        },
        component: () => import('@/view/argu-page/query.vue')
      }
    ]
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  }
]
